package org.com.coolfish.common.database.repository;

import java.util.List;

import org.com.coolfish.common.database.entity.KuyuPackage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface KuyuPackageRepository extends JpaRepository<KuyuPackage, Integer> {
    /*
     *  查找套餐包的使用时间
     */
    @Query("select  e.usetime  from KuyuPackage e where e.id =:id")
    Integer findUsetime(@Param("id") Integer id);
    
    @Query("SELECT new KuyuPackage(p.usetime,p.stackable,p.base) FROM KuyuPackage p WHERE p.id=:packageId")
    KuyuPackage findPackagePropert(@Param("packageId") Integer packageId);
    
    
    @Query("SELECT new KuyuPackage(p.oldPrice,p.price) FROM KuyuPackage p WHERE p.id=:packageId")
    KuyuPackage findPackagePrice(@Param("packageId") Integer packageId);
    
    @Query("SELECT new KuyuPackage(p.id,p.name,p.packageName,p.price,p.packageid,p.status,p.flow,p.usetime) FROM KuyuPackage p WHERE p.id=:packageId")
    KuyuPackage getPropert(@Param("packageId") Integer packageId);
} 
